﻿<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- doesnt work when using CDN
  <CustomAction
    ScriptSrc="~SiteCollection/Style Library/Scripts/jquery/ui/1.8.7/js/jquery-ui-1.8.7.custom.min.js"
    Location="ScriptLink"
    Sequence="20">
  </CustomAction>
  -->
  <CustomAction
    Location="ScriptLink"
    ScriptBlock="
if(typeof(jQuery) != 'undefined') {
  $(document).ready(
    function() { 
      var TildeSiteCollection = _spPageContextInfo.siteServerRelativeUrl;
      if(_spPageContextInfo.siteServerRelativeUrl.length != 1) {
          TildeSiteCollection += '/'
      }
      var head = $('head');
      head.append('&lt;script type=&quot;text/javascript&quot; src=&quot;' + TildeSiteCollection + 'Style Library/Scripts/jquery/ui/1.8.7/js/jquery-ui-1.8.7.custom.min.js&quot;&gt;&lt;/' + 'script&gt;');     
      head.append('&lt;link&gt;'); 
      var css = $('head').children(':last'); 
      css.attr({ 
        rel: 'stylesheet',
        type: 'text/css',
        href: TildeSiteCollection + 'Style Library/Scripts/jquery/ui/1.8.7/css/smoothness/jquery-ui-1.8.7.custom.css' 
      }); 
    }
  );
}
"
    Sequence="20">
  </CustomAction>
</Elements>
